home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 41.zip / BS1 part 41 / parallel-C disk ^1.adf / DOS.H < prev    next >
Text File  |  1997-12-31  |  3KB  |  113 lines

  1. /*
  2. ** DOS.H
  3. **
  4. ** The following definitions are modified versions of the ones
  5. ** available through Microsoft C, so that people using code from
  6. ** those implementations will find it easy to port programs.
  7. */
  8.  
  9. /*
  10. ** Note the following differences from a "real" PC implementation:
  11. **
  12. ** 1) The registers are in a different order to the order used
  13. **    by Microsoft: the order is that used by the Inmos server.
  14. ** 2) The 16-bit registers are unsigned short here so that they are
  15. **    16-bit objects.  Note that they are allocated 4 bytes each
  16. **    on the transputer, however.
  17. ** 3) The segment registers are available in the WORDREGS and REGS
  18. **    formats but are not usable by the programmer; they are included
  19. **    to simplify the work of the interrupt routines.
  20. ** 4) CFLAG is not used, only set.
  21. ** 5) The type pcpointer is available to define an 8086 far pointer;
  22. **    the top 16 bits of this are the segment number, the low 16 are
  23. **    the offset, e.g.:
  24. **
  25. **       pcpointer x = ...;
  26. **       union REGS r;
  27. **       struct SREGS s;
  28. **       s.ds   = x >> 16;
  29. **       r.x.dx = x & 0xFFFF;
  30. */
  31.  
  32. /*
  33. ** SREGS
  34. **
  35. ** This struct format defines the segment registers.
  36. */
  37. struct SREGS {
  38.    unsigned short cs;
  39.    unsigned short ds;
  40.    unsigned short es;
  41.    unsigned short ss;
  42. };
  43.  
  44. /*
  45. ** WORDREGS
  46. **
  47. ** This defines names for the word-oid registers, which will be
  48. ** overlayed by the byte registers later on.
  49. */
  50. struct WORDREGS {
  51.    unsigned short ax;
  52.    unsigned short bx;
  53.    unsigned short cx;
  54.    unsigned short dx;
  55.    unsigned short di;
  56.    unsigned short si;
  57.    struct SREGS sregs;
  58.    unsigned int cflag;
  59. };
  60.  
  61. /*
  62. ** BYTEREGS
  63. **
  64. ** Define the byte registers with enough dummies that they
  65. ** will properly overlay the word registers.
  66. */
  67. struct BYTEREGS {
  68.    unsigned char al, ah, xx1, xx2;
  69.    unsigned char bl, bh, xx3, xx4;
  70.    unsigned char cl, ch, xx5, xx6;
  71.    unsigned char dl, dh, xx7, xx8;
  72. };
  73.  
  74. /*
  75. ** REGS
  76. **
  77. ** Define a union which overlays the word and byte registers
  78. ** and also has the segment registers and the carry flag there
  79. ** as well.
  80. */
  81. union REGS {
  82.    struct WORDREGS x;
  83.    struct BYTEREGS h;
  84. };
  85.  
  86. /*
  87. ** pcpointer type defines an 8086 far pointer
  88. */
  89. typedef long int pcpointer;
  90. /*
  91. port_out(port,value)
  92. int port, value;
  93. {
  94.   int status;
  95.  
  96.   _put_int(37);
  97.   _put_int(port);
  98.   _put_int(value);
  99.   _get_int(&status);
  100. }
  101.  
  102. port_in(port,value)
  103. int port, *value;
  104. {
  105.   int status;
  106.  
  107.   _put_int(36);
  108.   _put_int(port);
  109.   _get_int(value);
  110.   _get_int(&status);
  111. }
  112.  
  113. */